package com.ibm.sova.abcd.cma;

import com.ibm.sova.abcd.cma.dto.ABCDResponseData;

/**
 * This interface defines the contract to parse ABCD request in certain format,
 * create an ABCDResponseData entity from request data.
 *
 * Thread safety: implementations are not required to be thread safe,
 * as it is used in a single-thread environment.
 */
public interface RequestParser {
    /**
     * Parses request data and outputs an ABCDResponseData entity.
     *
     * It is possible that error might occur during parsing, all errors are stored in
     * ABCDResponseData.overallMessages field, no exception is thrown.
     *
     * @param requestData
     *          request data in byte array, cannot be null
     * @return The ABCDResponseData
     * @exception IllegalArgumentException
     *          if any argument is invalid
     * @exception CMARequestParsingException
     *          if there is an error when parsing request data
     */
    public ABCDResponseData parseRequestData(byte[] requestData);
}

